Data for Designers: Connecting to Data in Flash Using Data Wizards
Table of Contents
Using the DataGrid Column Editor
The DataGrid Column Editor reorders, resizes, adds, and deletes columns from the DataGrid and can be used to change cells between editable and noneditable. You might want to tweak the columns slightly in the DataGrid component you just created in the previous example to change the heading titles and component dimensions. This is a simple task, thanks to Macromedia's buddy wizard, the DataGrid Column Editor:
- Select the DataGrid on the Stage from the previous example
- Open the Component Inspector panel.
- Choose DataGrid Column Editor from the Component wizards menu. The DataGrid Column Editor might seem a bit intimidating at first, but it is actually straightforward.
- The columns aren't visible in the wizard by default, so click the Import Columns button in the lower-left corner of the wizard to make them visible.
- Select the Title column and type Title in the Column Label text field.
Click the Creator column and type Author in the Column Label field (see Figure 5).
Figure 5. Changing column labels in the DataGrid Column Editor
- Click OK to finish the wizard and return to the Flash document. If you test the movie again, notice that the columns in the DataGrid have now updated, although now the column sizes need to be adjusted because the default width for each column is 50 pixels wide.
- Before you run the Column Editor wizard again, get the width of the DataGrid component itself. The default size of the DataGrid should be 460 pixels wide by 270 pixels high.
- Select the DataGrid and run the Column Editor wizard again from the Component Inspector panel. Select the Title column, set the column width to 360 pixels, and set the creator column to 100 pixels.
- When you are finished, click OK to close the wizard and test the movie (see Figure 6).
Figure 6. Read the current article titles and authors when you're finished.
Note: When dealing with column sizes, the scroll bar comes into play. Even though you specify a width of 100 pixels for the Author column, in reality it will be a lot closer to 80 pixels because of the presence of the scroll bar.
Addressing Cross-Domain and Security Issues
Movies running in Flash Player 7 can only access data from the same domain. Therefore, a SWF file cannot access data from another server without a special file, called a cross-domain policy file, placed on the server from which it accesses the data. For more information, read Security Changes in Macromedia Flash Player 7 (Macromedia Developer Center) and About Allowing Cross-Domain Data Loading (Flash livedocs).